//
//  SeniorityModel.m
//  NewMusic
//
//  Created by chuxinyu123 on 15/11/12.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "SeniorityModel.h"

@implementation SeniorityModel

- (void)dealloc
{
    [_channel_id release];
    [_code release];
    [_name release];
    [_parent_id release];
    [_refs release];
    [super dealloc];
}

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self.refs = [NSMutableArray array];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}


+ (SeniorityModel *)seniorityModelWithDictionary:(NSDictionary *)dictionary
{
    SeniorityModel *seniorityModel = [[SeniorityModel alloc] initWithDictionary:dictionary];
    return [seniorityModel autorelease];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

- (void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqual:@"channel_id"]) {
        self.channel_id = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqual:@"parent_id"]) {
        self.parent_id = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqual:@"refs"]) {
        for (NSDictionary *dictionary in value) {
            if ([[dictionary objectForKey:@"title"] isEqual:@"亚洲新歌榜"] || [[dictionary objectForKey:@"title"] isEqual:@"Beatport全球电子舞曲榜"]) {
            }else{
                SeniorityDataModel *seniorityDataModel = [SeniorityDataModel seniorityDataModelWithDictionary:dictionary];
                [_refs addObject:seniorityDataModel];
            }
        }
    }else{
        [super setValue:value forKey:key];
    }
}


@end
